<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<!-- The HEXBIN Utility (DOS) -->

<HTML>

<HEAD>

<TITLE>The HEXBIN Utility (DOS)</TITLE>

</HEAD>

<BODY BACKGROUND="spiral.gif" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#990099" ALINK="#FF0000">

<TABLE WIDTH="98%">
<TR><TD WIDTH=60 VALIGN=BOTTOM NOWRAP>
<IMG SRC="transp.gif" ALT="" WIDTH=60 HEIGHT=20>
</TD><TD>

<!-- Ab hier Seitentext: -->

<BIG>

<BR>

<P>
<STRONG><U>II.1.10 The HEXBIN Utility</U></STRONG>
</P>

<P>
Most EPROM programmers are accepting the <NOBR>Intel-HEX</NOBR> object file format that
is output by <NOBR>ASEM-51</NOBR>. However, for dumb EPROM burners and special purposes
it might be useful to convert the HEX file to a pure binary image file.
For this the conversion utility HEXBIN is provided.
It is invoked as follows:
</P>

<P>
<STRONG><PRE>
    HEXBIN &lt;hex&gt; [&lt;bin&gt;] [/OFFSET:o] [/LENGTH:l] [/FILL:f] [/QUIET]
</PRE></STRONG>
</P>

<P>
where &lt;hex&gt; is the input file in <NOBR>Intel-HEX</NOBR> format, and &lt;bin&gt; is the
binary output file. The parameter &lt;bin&gt; is optional. When omitted, the
file name is derived from the &lt;hex&gt; file name, but with the extension BIN.
All file names may be specified without extensions. In these cases, the
program adds default extensions as shown below:
</P>

<P>
<CENTER>
<TABLE BORDER CELLPADDING=8>
<TR><TH><BIG>file</BIG></TH><TH><BIG>extension</BIG></TH></TR>
<TR><TD><BIG>&lt;hex&gt;</BIG></TD><TD ALIGN=CENTER><BIG>.HEX</BIG></TD></TR>
<TR><TD><BIG>&lt;bin&gt;</BIG></TD><TD ALIGN=CENTER><BIG>.BIN</BIG></TD></TR>
</TABLE>
</CENTER>
</P>

<P>
If you want a file name to have no extension, terminate it with a '.'!
Instead of file names you may also specify device names to redirect the
output to character I/O ports. Device names may be terminated with a ':'!
It is not checked, whether the device is existing or suitable for the task.
</P>

<P>
The binary file output can also be controlled with the options /OFFSET,
/FILL and /LENGTH.
</P>

<P>
Normally the first byte in the binary file is the first byte of the HEX
record with the lowest load address. If a number of dummy bytes is to be
inserted on top of the file (e.g. for alignment in an EPROM image), this
can be performed with the /OFFSET option:
<BLOCKQUOTE>
<STRONG><PRE>
/OFFSET:1000
</PRE></STRONG>
</BLOCKQUOTE>
would insert 4096 dummy bytes before the first byte of the first HEX record
loaded. The offset must always be specified as a hex number. The default
offset is 0.
</P>

<P>
Since there may be peepholes between the HEX records, a fill byte value can
be defined with the /FILL option:
<BLOCKQUOTE>
<STRONG><PRE>
/FILL:0
</PRE></STRONG>
</BLOCKQUOTE>
would fill all peepholes between the HEX records with zero bytes as well as
all the dummy bytes that might have been inserted with the /OFFSET or /LENGTH
option. The fill byte value must always be specified as a hex number.
The default fill byte is the EPROM-friendly FFH.
</P>

<P>
By default the last byte in the binary file is the last byte of the HEX
record with the highest load address. If the binary file should have a
well defined length, then a number of dummy bytes can be appended to the
file (e.g. for exactly matching an EPROM length), this can be performed
with the /LENGTH option:
<BLOCKQUOTE>
<STRONG><PRE>
/LENGTH:8000
</PRE></STRONG>
</BLOCKQUOTE>
would append as many dummy bytes behind the last byte of the file, that the
total file length becomes exactly 32768 bytes. The file length must always
be specified as a hex number.
</P>

<P>
When HEXBIN has been invoked with all the above options, it may display a
file conversion report like this:
<PRE>
        Hex File Converter HEXBIN V2.3

                     offset:     1000H bytes
              first address:     9000H
               last address:     A255H
        fill peepholes with:       00H
        binary image length:     8000H bytes
</PRE>
The /QUIET option suppresses this console output, while error messages are
displayed regardless.
</P>

<P>
Options may be abbreviated as long as they remain unique!
</P>

<P>
<BR>
<STRONG>Examples:</STRONG>
<BLOCKQUOTE>
<STRONG><PRE>
0.)    HEXBIN
</PRE></STRONG>
<BLOCKQUOTE>
When invoked without parameters, HEXBIN displays a help screen:
</BLOCKQUOTE>
<PRE>
       Hex File Converter HEXBIN V2.3

       usage:       HEXBIN &lt;hexfile&gt; [&lt;binary&gt;] [options]

       options:     /OFFSET:offset
                    /LENGTH:length
                    /FILL:fillbyte
                    /QUIET
</PRE>
<STRONG><PRE>
1.)    HEXBIN PROGRAM
</PRE></STRONG>
<BLOCKQUOTE>
will convert the <NOBR>Intel-HEX</NOBR> file PROGRAM.HEX to a pure binary image file
PROGRAM.BIN.
</BLOCKQUOTE>
<STRONG><PRE>
2.)    HEXBIN TARZAN.OBJ JUNGLE/FILL:E5
</PRE></STRONG>
<BLOCKQUOTE>
will convert the <NOBR>Intel-HEX</NOBR> file TARZAN.OBJ to a binary image file
JUNGLE.BIN and fill all peepholes between the HEX file records with
the binary value E5H.
</BLOCKQUOTE>
<STRONG><PRE>
3.)    HEXBIN PROJECT EPROM. /off:8000 /length:10000 /f:0
</PRE></STRONG>
<BLOCKQUOTE>
will convert the <NOBR>Intel-HEX</NOBR> file PROJECT.HEX to a binary image
file EPROM, insert 32K dummy bytes on top of file, fill all peepholes
and the dummy bytes with nulls, and extend the file to exactly 64K.
</BLOCKQUOTE>
</BLOCKQUOTE>
</P>

<P>
When terminating HEXBIN returns an exit code to the operating system:
</P>

<P>
<CENTER>
<TABLE BORDER CELLPADDING=8>
<TR><TH ALIGN=LEFT><BIG>situation</BIG></TH><TH><BIG>ERRORLEVEL</BIG></TH></TR>
<TR><TD NOWRAP><BIG>no errors</BIG></TD><TD ALIGN=CENTER><BIG>0</BIG></TD></TR>
<TR><TD NOWRAP><BIG>conversion errors detected</BIG></TD><TD ALIGN=CENTER><BIG>1</BIG></TD></TR>
<TR><TD NOWRAP><BIG>fatal runtime error</BIG></TD><TD ALIGN=CENTER><BIG>2</BIG></TD></TR>
</TABLE>
</CENTER>
</P>

<P>
There is also a Win32 console-mode version of HEXBIN: HEXBINW.EXE!<BR>
HEXBINW is functionally identical to HEXBIN, but can handle long file names.
</P>

</BIG>

<!-- Seitentext Ende -->

<P>
<BR>
<BR>
<CENTER>
<TABLE WIDTH="70%">
<TR><TH><A HREF="contents.htm"><IMG SRC="home.gif" ALT="[contents]" BORDER=0 WIDTH=32 HEIGHT=32></A></TH>
    <TH><A HREF="doswin.htm"><IMG SRC="up.gif" ALT="[up]" BORDER=0 WIDTH=32 HEIGHT=32></A></TH>
    <TH><A HREF="asemw.htm"><IMG SRC="back.gif" ALT="[back]" BORDER=0 WIDTH=32 HEIGHT=32></A></TH>
    <TH><A HREF="linux.htm"><IMG SRC="next.gif" ALT="[next]" BORDER=0 WIDTH=32 HEIGHT=32></A></TH>
</TR>
</TABLE>
</CENTER>
</P>

</TD></TR>
</TABLE>

</BODY>

</HTML>
